import { takeEvery, put } from 'redux-saga/effects'
import axios from 'axios'
// import { useContext } from 'react'
import { List } from 'immutable'
import {loadDataSync} from './actionCreator'
// import axiosContext from '@/hooks/axiosContext'



function* loadData(action) {
    const result = yield axios.get(
        '/api/hospital?_start=0&_end=' + action.end
    )
    yield put(loadDataSync(List(result.data)))
}

function* homeSaga() {
    yield takeEvery('loadDataSaga', loadData)
}

export default homeSaga